#include <ctemplate/template.h>
#include <string>
#include <iostream>
using namespace std;

int main()
{
    string html = "./test.html";
    string val = "This is a test";

    // 形成数据字典
    ctemplate::TemplateDictionary root("mp"); // unorder_map<> mp
    root.SetValue("key", val);                // mp.insert()

    // 获取指定html的渲染对象
    ctemplate::Template *tp = ctemplate::Template::GetTemplate(html, ctemplate::DO_NOT_STRIP);

    // 添加(替换)字典数据到网页
    string outhtml;
    tp->Expand(&outhtml, &root); // 渲染html网页中的key字段

    cout << outhtml << endl;

    return 0;
}